package com.ly.common.dialog;

import android.content.Context;
import android.view.View;

import java.util.List;

/**
 * Created by admin on 2017/2/14.
 */

public class DropDownListDialog {
    /**
     * 显示下拉选择popwindow 可以通过isWarpContent设置是否包裹内容
     *
     * @param context
     *            上下文
     * @param dataList
     *            list数据
     * @param listener
     *            选择回调函数
     * @param view
     *            要显示在哪个view下面
     * @param isWarpConent
     *            是否包裹内容
     *
     */
    public static SpinerPopWindow showSelectPopWindow(Context context, List<String> dataList,
                                                      AbstractSpinerAdapter.IOnItemSelectListener listener, View view, boolean isWarpConent)
    {
        SpinerPopWindow mSpinerPopWindow = new SpinerPopWindow(context);
        mSpinerPopWindow.setWarpContent(isWarpConent);
        mSpinerPopWindow.refreshData(dataList, 0);
        mSpinerPopWindow.setItemListener(listener);
        mSpinerPopWindow.setWidth(view.getWidth());
        mSpinerPopWindow.setView(view);
        mSpinerPopWindow.showAsDropDown(view);
        return mSpinerPopWindow;
    }
}
